$(function () {

    $('#tabs').tabs('add', {
        title:"口丁良首页",
        closable: true,
        fit: true,
        selected: true,
        content: "<iframe src='http://www.wolfcode.cn' width='97%' height='97%' frameborder='0'></iframe>"
    })


    $("#system_tree").tree({
        url: "/static/json/tree.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }


            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });

    $("#client_tree").tree({
        url: "/static/json/tree2.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }


            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });
    $("#student_tree").tree({
        url: "/static/json/tree3.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }


            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });
    $("#hr_tree").tree({
        url: "/static/json/tree4.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }


            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });
    $("#course_tree").tree({
        url: "/static/json/tree5.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }

            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });
    $("#self_tree").tree({
        url: "/static/json/tree6.json",
        onClick: function (node) {

            //判断选项卡是否重复
            var boolean = $('#tabs').tabs("exists", node.text);
            if (boolean) {
                //如果存在则选中
                $('#tabs').tabs("select", node.text);
                return;
            }


            //添加新的选项卡并选中
            $('#tabs').tabs('add', {
                title: node.text,
                closable: true,
                fit: true,
                selected: true,
                content: "<iframe src='" + node.url + "' width='97%' height='97%' frameborder='0'></iframe>"
            });
        }
    });
})